// http://47.108.197.28:4000/api/search?keyword=你
// http://47.108.197.28:4000/api/movie/top250
// http://47.108.197.28:4000/api/movie/inTheaters
// http://47.108.197.28:4000/api/movie/comingSoon
// http://47.108.197.28:4000/api/movieDetail?id=60418ed19e3f3d1f6cf8f871
const http = require("./http");
class MovieHttp extends http {
  static getTop250MovieHttp() {
    return this.request(`4000/api/movie/top250`)
  }
  static getInTheatersMovieHttp() {
    return this.request(`4000/api/movie/inTheaters`)
  }
  static getComingSoonMovieHttp() {
    return this.request(`4000/api/movie/comingSoon`)
  }
  static getDeatilMovieHttp(id) {
    return this.request(`4000/api/movieDetail?id=${id}`)
  }
  static getSearchMovieHttp(id) {
    return this.request(`4000/api/search?keyword=${id}`)
  }
  static getHttp(url) {
    return this.request(`${url}`)
  }
  static handleStar(num) {
    var arr = []
    for (var i = 0; i < 5; i++) {
      if (num >= 2) {
        arr.push(2)
      } else if (num > 0) {
        arr.push(Number(num.toFixed(1)))
      } else {
        arr.push(0)
      }
      num = num - 2
    }
    return arr;
  }
}
module.exports = MovieHttp;